package knu;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by Ray on 2014-12-09.
 */
@WebServlet(name = "Servlet_Sum")
public class Servlet_Sum extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=utf-8");
        int sum=0;
        for(int i=1; i<100; i++)
            sum+=i;
        response.getWriter().println("1부터 100까지의 합은 "+sum+"입니다");

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
         }
}
